package com.main.ok.push;

import java.util.HashMap;
import java.util.Map;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.greenline.push.services.PushCenterCommonService;
import com.greenline.push.services.dto.ResponseDTO;

/**
 * 
 * @Type ApnsShanghfzTest
 * @Desc 红房子测试
 * @author kf
 * @date 2015年4月1日
 * @Version V1.0
 */
public class ApnsShanghfzTest {
    public static void main(String[] args) {
        // {"appChannelId":53,"appId":"p_ios_shanghai_hfzfckyy","appTemplateId":94,"context":"术前提醒\\n{\"content\":\"\",\"date\":\"1427857386971\",\"id\":\"\",\"type\":98}","dbMsgId":4258589,"dbRetryId":3875282,"domainId":37,"extParam":{"content":"{\"content\":\"\",\"date\":\"1427857386971\",\"id\":\"\",\"type\":98}","title":"术前提醒"},"extTemplId":"","priority":1,"recvUserId":5561947,"status":0,"templateId":30,"type":0}
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        /**
         * dubbo服务获取
         */
        PushCenterCommonService pushService = (PushCenterCommonService) ctx.getBean("pushService");
        Map<String, String> params = new HashMap<String, String>();
        params.put("title", "左帅两个-红房子医院推送");
        params.put("content", "{\"content\":\"\",\"date\":\"" + System.currentTimeMillis() + "\",\"id\":\"\",\"type\":98}");
        
        ResponseDTO<Boolean> s;
        for (int i = 0; i <1; i++) {
//            s = pushService.send(6339476l, "apnsCommonPushTemplate", "telConsultPatientDomain", params, null);
            s = pushService.send(12124550l, "apnsCommonPushTemplate", "p_ios_hfzfckyy_domain", params, null);
            System.out.println(s.getMessage() + "--" + s.getErrorMsg());
        }
    }

}
